/**
 * 
 */
package springbootstudy.hibernate.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import springbootstudy.hibernate.Person;
import springbootstudy.hibernate.service.PersonService;

/**
 * @author Administrator
 *
 */
@RestController
public class PersonController {

	@Resource
	private PersonService personService;

	@RequestMapping("/save")
	public String save() {
		Person p = new Person();
		p.setName("静静");
		personService.save(p);
		return "save ok-" + p.getId();
	}

	@RequestMapping("/findName")
	public Person findName(String name) {
		return personService.findByName(name);
	}

	@RequestMapping("/findName2")
	public Person findName2(String name) {
		System.err.println("22222222");
		return personService.findByName2(name);
	}

	@RequestMapping("/select")
	public Person select(Long id) {
		System.err.println("select.......");
		return personService.selectOne(id);
	}

}
